import requests
import re

url = 'https://movie.douban.com/top250'

headers = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36"
}
resp = requests.get(url = url,headers = headers)

obj = re.compile('<li>.*?<div class="item">.*?<span class="title">(?P<name>.*?)</span>',re.S)

page_content = resp.text
result = obj.finditer(page_content)

for a in result:
    print(a.group("name"))

resp.close()